﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using Marbles.Core.Authentication;
using System.Xml.Serialization;

namespace Marbles.Web.Services
{
    /// <summary>
    /// Summary description for Authentication
    /// </summary>
    [WebService(Namespace = "http://www.riaweb.co.uk/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.None)]
    [System.ComponentModel.ToolboxItem(false)]

    public class Authentication : System.Web.Services.WebService
    {

        [WebMethod(Description = "Login to the System with the specific credentials.")]
        public bool Login(string username, string password)
        {
            AuthenticationProvider auth = AuthenticationProvider.CreateProviderInstance();
            return auth.Login(username, password);
        }

        [WebMethod(Description = "Returns Authentication Token for Specified Credentials.")]
        public Marbles.Core.Authentication.Generic.IdentityToken GetToken(string username, string password)
        {
            AuthenticationProvider auth = AuthenticationProvider.CreateProviderInstance();
            return auth.GetToken(username, password) as Marbles.Core.Authentication.Generic.IdentityToken;
        }

        [WebMethod(Description = "Logout of the System.")]
        public bool Logout()
        {
            AuthenticationProvider auth = AuthenticationProvider.CreateProviderInstance();
            return auth.Logout();
        }

    }
}
